import agentFramework.action.Action;
import agentFramework.agent.Agent;
import agentFramework.core.env.Environment;
import agentFramework.strategy.Strategy;
import agentFramework.utils.Pair;


public class DilemmaBullyStrategy extends Strategy  
{
		
	public DilemmaBullyStrategy(Environment env, Agent owner)
	{
		super(env, owner);
	}
	
	
	@Override
	public void init() 
	{
		// DO NOTHING
	}
	
	
	@Override
	public Action makeDecision() 
	{
		int expensiveCount = 0;
		for (Pair<Integer, Action> decision : this.agentDecisions)
		{
			if (decision.second.getType() == DilemmaAction.TYPE_EXPENSIVE_MEAL)
			{
				expensiveCount++;
			}
		}
		
		if (expensiveCount < this.agent.neighborList.size())
		{
			return new DilemmaAction(DilemmaAction.TYPE_CHEAP_MEAL);
		}
		
		return new DilemmaAction(DilemmaAction.TYPE_EXPENSIVE_MEAL);
	}

	
	@Override
	public void reviseStrategy() 
	{
		this.agent.addEarnings(environment.computeReward(this.agent));
	}

}
